package com.kefu.exam.vo;

import javax.validation.constraints.Size;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.exam.model.ExamPaper;
import cn.hutool.core.util.IdUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author xy
 * @date 2022/02/28
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "考卷表")
public class ExamPaperInsertVo extends AbstractInsertVo<ExamPaper> {

    @Size(max = 500)
    @ApiModelProperty(value = "试卷名")
    private String paperName;

    @Size(max = 500)
    @ApiModelProperty(value = "试卷描述信息")
    private String paperDescription;

    @Override
    public ExamPaper convert() {
        KefuContext context = KefuContext.getKefuContext();
        ExamPaper info = new ExamPaper();
        info.setPaperId(IdUtil.simpleUUID());
        info.setPaperName(paperName);
        info.setPaperDescription(paperDescription);
	    info.setTenantId(context.getTenantId());
	    info.setCreateUser(context.getUserId());
	    info.setCreateTime(context.getNow());
        info.setCreateName(context.getUserName());
	    info.setUpdateUser(context.getUserId());
	    info.setUpdateTime(context.getNow());
	    info.setUpdateName(context.getUserName());
	    return info;
	}
}